package org.vaadin.nf4v.ext.config.menu;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Page annotation.
 * Allows to define menu item for page or window (and later build menu automatically with runtime extension)
 * <p/>
 * Annotation may be applied to context to avoid root menu path element duplication in all menu items, e.g.
 * context menu item is: Administration, and page menu item is "Control/Users" then complete menu item path
 * will be "Administration/Control/Users"
 */
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Menu {
    /**
     * Menu name may contain sublevels e.g. "Administration/Control/Users", which may be rendered
     * as submenus: "Administration" -> "Control" -> "Users".
     *
     * @return menu name.
     */
    String name();

    /**
     * By default menu items in menu will be rendered by name.
     * Weight adds additional sorting dimension: items with less weight goes upper,
     * items with the same weight are sorted by name.
     *
     * @return menu item weight.
     */
    int weight() default 0;

    /**
     * @return source path for menu item icon
     */
    String icon() default "";

    /**
     * @return true if menu item requires additional separator before it (if it not goes first)
     */
    boolean separate() default false;

    /**
     * Context sensitive means that this menu item will work only in it's context.
     * If context sensitive is false then menu item will switch context if necessary.
     *
     * @return true if menu item is context sensitive, false otherwise
     */
    boolean contextSensitive() default false;
}
